package com.scalar.chiptrack.sales.forms.quote;

import com.scalar.chiptrack.ChipTrackActionForm;
import com.scalar.chiptrack.sales.Quotation;
import com.scalar.chiptrack.utils.StringUtils;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * Author: Prabhanjan
 * Date: Feb 11, 2004
 * Time: 9:29:32 AM
 */
public class ApproverQuotationForm extends ChipTrackActionForm
{
    // --------------------------------------------------- Instance Variables


    private String action = null;

    private Quotation quotation = new Quotation ();

    private boolean financeHold = false;
    private String financeHoldUser = null;
    private boolean operationsHold = false;
    private String operationsHoldUser = null;
    private boolean marketingHold = false;
    private String marketingHoldUser = null;
    private boolean salesHold = false;
    private String salesHoldUser = null;
    private int quotationId = -1;
    private String comments = null;
    private String quotationNo = null;


    private String[] lineItemNo;
    private String[] scheduleDate;
    private String[] revisedDate;

    private static int totalQty;
    private static float totalAmount;

    // ----------------------------------------------------------- Properties

    /**
     * Get Quotation
     *
     * @return Quotation
     */
    public Quotation getQuotation ()
    {
        return quotation;
    }

    /**
     * Set the Quotation
     *
     * @param quotation
     */
    public void setQuotation ( Quotation quotation )
    {
        this.quotation = quotation;
    }

    /**
     * Get action
     *
     * @return action
     */
    public String getAction ()
    {
        return action;
    }

    /**
     * Set the action
     *
     * @param action
     */
    public void setAction ( String action )
    {
        this.action = action;
    }

    public int getQuotationId ()
    {
        return quotationId;
    }

    public void setQuotationId ( int quotationId )
    {
        this.quotationId = quotationId;
    }

    public boolean getFinanceHold ()
    {
        return financeHold;
    }

    public void setFinanceHold ( boolean financeHold )
    {
        this.financeHold = financeHold;
    }

    public boolean getOperationsHold ()
    {
        return operationsHold;
    }

    public void setOperationsHold ( boolean operationsHold )
    {
        this.operationsHold = operationsHold;
    }

    public boolean getMarketingHold ()
    {
        return marketingHold;
    }

    public void setMarketingHold ( boolean marketingHold )
    {
        this.marketingHold = marketingHold;
    }

    public boolean getSalesHold ()
    {
        return salesHold;
    }

    public void setSalesHold ( boolean salesHold )
    {
        this.salesHold = salesHold;
    }

    public String getFinanceHoldUser ()
    {
        return financeHoldUser;
    }

    public void setFinanceHoldUser ( String financeHoldUser )
    {
        this.financeHoldUser = financeHoldUser;
    }

    public String getOperationsHoldUser ()
    {
        return operationsHoldUser;
    }

    public void setOperationsHoldUser ( String operationsHoldUser )
    {
        this.operationsHoldUser = operationsHoldUser;
    }

    public String getMarketingHoldUser ()
    {
        return marketingHoldUser;
    }

    public void setMarketingHoldUser ( String marketingHoldUser )
    {
        this.marketingHoldUser = marketingHoldUser;
    }

    public String getSalesHoldUser ()
    {
        return salesHoldUser;
    }

    public void setSalesHoldUser ( String salesHoldUser )
    {
        this.salesHoldUser = salesHoldUser;
    }

    public String getApproverComments ()
    {
        return comments;
    }

    public void setApproverComments ( String comments )
    {
        this.comments = comments;
    }

    public String[] getLineItemNo ()
    {
        return lineItemNo;
    }

    public void setLineItemNo ( String[] lineItemNo )
    {
        this.lineItemNo = lineItemNo;
    }

    public String[] getScheduleDate ()
    {
        return scheduleDate;
    }

    public void setScheduleDate ( String[] scheduleDate )
    {
        this.scheduleDate = scheduleDate;
    }

    public String[] getRevisedDate ()
    {
        return revisedDate;
    }

    public void setRevisedDate ( String[] revisedDate )
    {
        this.revisedDate = revisedDate;
    }

    public String getTotalQty ()
    {
        return StringUtils.formatUnits ( totalQty );
    }

    public void setTotalQty ( int totalQty )
    {
        this.totalQty = totalQty;
    }

    public String getTotalAmount ()
    {
        return StringUtils.formatAmountWithNoOfDecimals ( totalAmount );
    }

    public void setTotalAmount ( float totalAmount )
    {
        this.totalAmount = totalAmount;
    }

    public String getQuotationNo ()
    {
        return quotationNo;
    }

    public void setQuotationNo ( String quotationNo )
    {
        this.quotationNo = quotationNo;
    }

    // --------------------------------------------------------- Public Methods


    /**
     * Reset all properties to their default values.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public void reset ( ActionMapping mapping, HttpServletRequest request )
    {


    }


    /**
     * Validate the properties that have been set from this HTTP request,
     * and return an <code>ActionErrors</code> object that encapsulates any
     * validation errors that have been found.  If no errors are found, return
     * <code>null</code> or an <code>ActionErrors</code> object with no
     * recorded error messages.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public ActionErrors validate ( ActionMapping mapping,
                                   HttpServletRequest request )
    {

        ActionErrors errors = new ActionErrors ();

        //if ((vendorName == null) || (vendorName.length() < 1))
        //    errors.add("Vendor", new ActionError("error.vendor name.required"));

        return errors;

    }


}
